<template>
    <el-dialog
        class="dialog"
        :destroy-on-close="true"
        title="门禁功能"
        :visible.sync="isShow"
        :close-on-click-modal="false"
        @close="onDialogClose"
    >
        <el-form
            ref="form"
            label-width="auto"
            class="form"
            :model="formData"
            :rules="rules"
        >
            <el-form-item label="门禁名称">
                <el-input v-model="infoData.door_name" disabled></el-input>
            </el-form-item>
            <el-form-item label="门禁GUID">
                <el-input v-model="infoData.door_guid" disabled></el-input>
            </el-form-item>
           <el-form-item label="门禁功能">
                <el-checkbox
                    :true-label="1"
                    :false-label="2"
                    v-model="formData.is_face"
                >
                    人脸开门
                </el-checkbox>
                <el-checkbox
                    :true-label="1"
                    :false-label="2"
                    v-model="formData.is_temp_pwd"
                >
                    密码开门
                </el-checkbox>
                <el-checkbox
                    :true-label="1"
                    :false-label="2"
                    v-model="formData.is_qrcode_active"
                >
                    二维码主扫
                </el-checkbox>
                <el-checkbox
                    :true-label="1"
                    :false-label="2"
                    v-model="formData.is_id_card"
                >
                    IC卡开门
                </el-checkbox>
                <el-checkbox
                :true-label="1"
                :false-label="2"
                v-model="formData.is_tk"
            >
                梯控门禁
            </el-checkbox>

 
            </el-form-item>
        </el-form>
        <div slot="footer" class="dialog-footer">
            <el-button @click="onDialogClose">取消</el-button>
            <el-button type="primary" @click="onSubmit">确认</el-button>
        </div>
    </el-dialog>
</template>

<script lang="ts">
import { Component, Vue } from "vue-property-decorator";
import { Action } from "vuex-class";
import { mixinDialogForm } from "@/mixin/dialog/Form";
@Component({
    mixins: [mixinDialogForm]
})
export default class equipmentDoorSet extends Vue {
    @Action("equipmentDoor/manageset") itemEdit: any;
    editInit(data: any) {
         const me = this as any;
        me.formData = Object.assign({}, me.formData, data);
    }

    operationData: any = [
        { label: '远程开门', value: 'open' },
        { label: '远程重启', value: 'reboot' },
        { label: '重置门禁时间', value: 'retime' },
        { label: '远程升级', value: 'upgrade' }
    ];


    // 表单数据
    formData: any = {
        is_face: "",
        is_temp_pwd: "",
        is_qrcode_active: "",
        is_ic_card: "",
        is_id_card: "",
        is_qrcode_passive: "",
        is_finger: "",
        is_tk: "",
        scan_code: "",
        id_open: ""
    };

    /**
     * 校验配置
     *
     * @type {*}
     * @memberof mixinViewRules
     */
    rules: any = {
        is_face: [
            {
                required: true,
                message: "请选择是否支持人脸开门"
            }
        ],
        is_temp_pwd: [
            {
                required: true,
                message: "请选择是否支持密码开门"
            }
        ],
        is_qrcode_active: [
            {
                required: true,
                message: "请选择是否支持二维码主扫开门"
            }
        ],
        is_ic_card: [
            {
                required: true,
                message: "请选择是否支持秘钥卡开门"
            }
        ],
        is_id_card: [
            {
                required: true,
                message: "请选择是否支持IC卡开门"
            }
        ],
        is_qrcode_passive: [
            {
                required: true,
                message: "请选择是否支持二维码被扫开门"
            }
        ],
        is_finger: [
            {
                required: true,
                message: "请选择是否支持人脸开门"
            }
        ],
        is_tk: [
            {
                required: true,
                message: "请选择是否支持梯控"
            }
        ]
    };
}
</script>
